#include "TelephoneBook.h"

enum data
{
    _insert = 1,
    _delete,
    _show,
    _update,
    _exit
};

int main()
{
    _t_book book;
    int choice;
    _init_telephone_book(&book);
    char old_phone_number[Size];
    while (1) 
    {
        printf("\n1、插入新用户\n");
        printf("2、删除用户\n");
        printf("3、查看用户\n");
        printf("4、修改用户\n");
        printf("5、退出\n");
        printf("请输入你的选择：");
        scanf("%d", &choice);
        switch (choice) 
        {
            case 1:
                _insert_telephone_book(&book);
                break;
            case 2:
                _delete_telephone_book(&book);
                break;
            case 3:
                _search_telephone_book(&book);
                break;
            case 4:
                printf("请输入要修改的联系人的电话号码:");
                scanf("%s", old_phone_number);
                _update_telephone_book(&book, old_phone_number);
                break;
            case 5:
                printf("退出程序。\n");
                return 0;
            default:
                printf("无效的选项，请重新输入。\n");
        }
    }
    return 0;
}